import { _decorator, AnimationClip, Component, Node } from 'cc';
import { StateMachine } from '../../Base/StateMachine';
import State from '../../Base/State';
import { PARAMS_NAME_ENUM, SPIKES_COUNT_ENUM, SPIKES_COUNT_MAP_NUMBER_ENUM } from '../../Enums';
import { SubStateMachine } from '../../Base/SubStateMachine';
const { ccclass, property } = _decorator;

const BASE_URL = `texture/spikes/spikesone`

export default class SpikeOneSubStateMachine extends SubStateMachine {

    constructor(fsm: StateMachine) {
        super(fsm)
        this.stateMachine.set(SPIKES_COUNT_ENUM.ZERO, new State(fsm, `${BASE_URL}/zero`));
        this.stateMachine.set(SPIKES_COUNT_ENUM.ONE, new State(fsm, `${BASE_URL}/one`));
        this.stateMachine.set(SPIKES_COUNT_ENUM.TWO, new State(fsm, `${BASE_URL}/two`));
    }

    run() {
        const value = this.fsm.getParams(PARAMS_NAME_ENUM.SPIKES_CUR_COUNT)
        this.currentState = this.stateMachine.get(SPIKES_COUNT_MAP_NUMBER_ENUM[value as number])
    }
}


